package com.testmanager.testmananger.quantitative.constants;

import com.testmanager.testmananger.foundation.domain.enums.EnumBase;

import java.util.Arrays;

public enum DemandType implements EnumBase {
    FUNCTIONADD("新功能",0),
    FUNCTIONUPDATE("功能更新",1),
    API("api",2),
    ACTIVITY("活动",3),
    OTHER("其他",4)
    ;
    public static final String CODE = "demand_type";
    private final String name;
    private final Integer value;

    DemandType(String name , int value){
        this.name = name;
        this.value=value;
    }

    public static DemandType getValueOf(Integer value){

        return Arrays.stream(DemandType.values())
                .filter(t->t.getValue().equals(value))
                .findFirst()
                .orElse(DemandType.ACTIVITY);
    }


    @Override
    public String getName() {
        return name;
    }

    @Override
    public Integer getValue() {
        return value;
    }
}
